package com.ruoyi.project.WebMoudle.advShow.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.WebMoudle.advShow.domain.AdvDistance;
import com.ruoyi.project.WebMoudle.advShow.domain.SearchShop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.advShow.mapper.AdvShowMapper;
import com.ruoyi.project.WebMoudle.advShow.domain.AdvShow;
import com.ruoyi.project.WebMoudle.advShow.service.IAdvShowService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 店铺广告Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-02
 */
@Service
public class AdvShowServiceImpl implements IAdvShowService 
{
    @Autowired
    private AdvShowMapper advShowMapper;

    /**
     * 查询店铺广告
     * 
     * @param id 店铺广告ID
     * @return 店铺广告
     */
    @Override
    public AdvShow selectAdvShowById(Long id)
    {
        return advShowMapper.selectAdvShowById(id);
    }

    /**
     * 查询店铺广告列表
     * 
     * @param advShow 店铺广告
     * @return 店铺广告
     */
    @Override
    public List<AdvShow> selectAdvShowList(AdvShow advShow)
    {
        return advShowMapper.selectAdvShowList(advShow);
    }

    /**
     * 新增店铺广告
     * 
     * @param advShow 店铺广告
     * @return 结果
     */
    @Override
    public int insertAdvShow(AdvShow advShow)
    {
        advShow.setCreateTime(DateUtils.getNowDate());
        return advShowMapper.insertAdvShow(advShow);
    }

    /**
     * 修改店铺广告
     * 
     * @param advShow 店铺广告
     * @return 结果
     */
    @Override
    public int updateAdvShow(AdvShow advShow)
    {
        advShow.setUpdateTime(DateUtils.getNowDate());
        return advShowMapper.updateAdvShow(advShow);
    }

    /**
     * 删除店铺广告对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdvShowByIds(String ids)
    {
        return advShowMapper.deleteAdvShowByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除店铺广告信息
     * 
     * @param id 店铺广告ID
     * @return 结果
     */
    @Override
    public int deleteAdvShowById(Long id)
    {
        return advShowMapper.deleteAdvShowById(id);
    }

    @Override
    public List<AdvDistance> queryAdvList(String currentLat, String currentLng) {
        return advShowMapper.queryAdvList(currentLat,currentLng);
    }

    @Override
    public List<AdvDistance> searchShopList(SearchShop ssp) {
        return advShowMapper.searchShopList(ssp);
    }
}
